using System;
using System.Data.SqlClient;

/// <summary>
/// A class that represents a spec example
/// </summary>
public class PsSpecHelpExample : IPsSpecDataReader, IEquatable<PsSpecHelpExample>
{
    public PsSpecHelpExample() { }

    public void Initialize(SqlDataReader reader, System.Collections.Generic.Dictionary<string, Int32> columnMappings)
    {
        this.specHelpExampleId = reader.GetInt32(columnMappings["Id"]);
        this.command = reader[columnMappings["Command"]] as string;
        this.output = reader[columnMappings["Output"]] as string;
        this.description = reader[columnMappings["Description"]] as string;
        this.cmdletId = reader.GetInt32(columnMappings["CmdletId"]);
    }

    public int Id
    {
        get { return specHelpExampleId; }
        set { specHelpExampleId = value; }
    }
    private int specHelpExampleId;

    public int CmdletId
    {
        get { return cmdletId; }
        set { cmdletId = value; }
    }
    private int cmdletId;

    public string Command
    {
        get { return command; }
        set { command = value; }
    }
    private string command;

    public string Output
    {
        get { return output; }
        set { output = value; }
    }
    private string output;

    public string Description
    {
        get { return description; }
        set { description = value; }
    }
    private string description;

    #region IEquatable<PsSpecHelpExample> Members

    public bool Equals(PsSpecHelpExample other)
    {
        if (other == null)
        {
            return false;
        }

        if (this.Id == other.Id)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    #endregion
}